<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .flex-table {
        display: flex;
        flex-direction: column;
        height: 300px;
        border: 1px solid #ccc;
        border-collapse: collapse;
      }

      .flex-table thead {
        flex: 0 0 auto;
        background: #f5f5f5;
      }

      .flex-table tbody {
        flex: 1 1 auto;
        display: block;
        overflow-y: auto;
        &::-webkit-scrollbar {
          display: none;
        }
      }

      .flex-table thead tr,
      .flex-table tbody tr {
        display: table;
        width: 100%;
        table-layout: fixed;
      }
      th,
      td {
        border-bottom: 1px solid #ccc;
        border-right: 1px solid #ccc;
        text-align: center;
      }
    </style>
  </head>
  <body>
    <table class="flex-table">
      <thead>
        <tr>
          <th>序号</th>
          <th>姓名</th>
          <th>年龄</th>
          <th>性别</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
        <tr>
          <td>1</td>
          <td>张三</td>
          <td>12</td>
          <td>男</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
